# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-kramdown
_gemname=kramdown
pkgver=2.4.0
_pkgver="REL_${pkgver//./_}"
pkgrel=2
pkgdesc="A fast, pure Ruby Markdown superset converter"
url="https://kramdown.gettalong.org/"
arch="noarch"
license="MIT"
depends="ruby ruby-rexml"
checkdepends="ruby-minitest ruby-rouge"
makedepends="ruby-rake"
source="https://github.com/gettalong/kramdown/archive/$_pkgver/ruby-kramdown-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$_pkgver"

prepare() {
	default_prepare

	# Remove tests that require gem "stringex" (we don't have it in aports yet).
	rm test/testcases/block/04_header/with_auto_ids.*
}

build() {
	rake gemspec
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--bindir "$pkgdir/usr/bin" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions
}

sha512sums="
38e411cb14fa823095be410aa62793072d98bc81b84b1642c431bf094da54137d5ee8ae59bccd6b68cda34a7506ef175706dfaf08052ad703e835855cf59f7e5  ruby-kramdown-2.4.0.tar.gz
6c724b3b26ff06ea78a60af37b9fdc12ff1ef15ec388807284c38bc60dc1e412d060576a3b4cfd981e22d1f48b7d12a184cef7b76b31072d3a323a738d4f6ffb  gemspec.patch
"
